import request from '@/utils/request'

/**
 * 分页查询积分类型
 *
 * @param {类型、类型名查询条件} query
 */
export function getTypeList(query) {
  return request({
    url: '/base/point/type/list',
    method: 'get',
    params: query
  })
}

/**
 * 分页查询积分类型码表
 *
 * @param {类型、类型名查询条件} query
 */
export function getCodeList(query) {
  return request({
    url: '/base/point/code/list',
    method: 'get',
    params: query
  })
}

/**
 * 删除积分信息
 * @param {积分ID} pointTypeId
 */
export function deletePoint(pointTypeId) {
  return request({
    url: '/base/point/delete',
    method: 'post',
    params: { pointTypeId }
  })
}

/**
 * 删除积分类型
 * @param {积分类型} pointType
 */
export function deletePointTypeInfo(pointType) {
  return request({
    url: '/base/point/type/delete',
    method: 'post',
    params: { pointType }
  })
}

/**
 * 更新数据类型信息
 *
 * @param {类型更新信息} point
 */
export function updatePointTypeInfo(point) {
  return request({
    url: '/base/point/type/update',
    method: 'post',
    data: point
  })
}

/**
 * 更新积分信息
 *
 * @param {积分信息} point
 */
export function updatePoint(point) {
  return request({
    url: '/base/point/update',
    method: 'post',
    data: point
  })
}

/**
 * 新增积分信息
 * @param {积分信息} point
 */
export function createPoint(point) {
  return request({
    url: '/base/point/create',
    method: 'post',
    data: point
  })
}

/**
 * 检验数据类型是否存在
 *
 * @param {类型} pointType
 */
export function checkTypeExists(pointType) {
  return request({
    url: '/base/point/type/exists',
    method: 'post',
    params: { pointType }
  })
}
